package org.example.backend.common;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author 啊昌
 * @date 2025/7/19 11:51
 * GlobalExceptionHandler 拦截controller的全局异常
 */
@RestControllerAdvice //拦截controller的全局异常
public class GlobalExceptionHandler {
	private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);

	@ExceptionHandler(Exception.class) //拦截Exception异常
	public String handleException(final RuntimeException e) {
		return e.getMessage();
	}
}
